Imports System.Data
Imports System
Imports Microsoft.VisualBasic
Imports System.Web.UI
Imports System.IO
Imports System.Drawing
Imports DevExpress.Web.ASPxPopupControl

Partial Class Pages_Controls_ctlEmitirCarnet
    Inherits System.Web.UI.UserControl

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Me.IsPostBack Then
            txtStartDate.Value = FormatDateTime(DateAdd(DateInterval.Day, -1, Now), DateFormat.ShortDate)
            txtEndDate.Value = FormatDateTime(Now, DateFormat.ShortDate)
            txtStartDate.Text = txtStartDate.Value
            txtEndDate.Text = txtEndDate.Value
            cboEstado.Items.Insert(0, New DevExpress.Web.ASPxEditors.ListEditItem("Seleccionar Estado", "0"))
            cboEstado.SelectedIndex = 0
            'cboEstado.Items.Insert(0, New DevExpress.Web.ASPxEditors.ListEditItem("Seleccionar Responsable", "0"))
            'cboEstado.Items.Insert(0, New DevExpress.Web.ASPxEditors.ListEditItem("Seleccionar Responsable", "0"))
        End If
    End Sub

    Protected Sub CargaDatosCarnet()
        Dim objPersona As New BusinessLogic.crPersona
        Dim objFamiliar As New BusinessLogic.crFichaFamiliar
        Dim dtFichaCarnet As DataTable

        Try
            tblGenerar.Visible = False
            dtFichaCarnet = objPersona.GetEmitirCarnet(txtStartDate.Text, txtEndDate.Text).Tables(0)
            If dtFichaCarnet.Rows.Count > 0 Then
                gridFichaFamilares.DataSource = dtFichaCarnet
                gridFichaFamilares.DataBind()
                tblGenerar.Visible = True
            Else
                lblMensaje.Text = "No hay carnets listos para imprimir"
            End If

        Catch ex As Exception
            lblMensaje.Text = ex.Message
        End Try

    End Sub

    Protected Sub btnConsultar_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        lblMensaje.Text = ""
        CargaDatosCarnet()
    End Sub
End Class
